package cn.huiyunche.base.service.interfaces.impl;

import cn.huiyunche.base.service.interfaces.BFeeDiscountService;
import cn.huiyunche.base.service.mappers.BFeeDiscountMapper;
import cn.huiyunche.base.service.model.BFeeDiscount;
import cn.huiyunche.base.service.model.BFeeDiscountExample;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BFeeDiscountServiceImpl implements BFeeDiscountService {

    private static final Logger LOGGER = LoggerFactory.getLogger(BFeeDiscountServiceImpl.class);

    @Autowired
    private BFeeDiscountMapper bFeeDiscountMapper;

    @Override
    public List<BFeeDiscount> getList(List<Long> feeIds) {
        LOGGER.info("getList param : {}", feeIds.size());
        if (CollectionUtils.isEmpty(feeIds)) {
            LOGGER.error("getList feeIds must not be empty");
            throw new IllegalArgumentException("费用id不能为空");
        }

        BFeeDiscountExample example = new BFeeDiscountExample();
        example.createCriteria().andFeeTypeIdIn(feeIds);
        return bFeeDiscountMapper.selectByExample(example);
    }


}
